'''
Created on 2013-6-27

@author: ZuoPeng
'''
from fractions import gcd

def p65(x):
    l = []
    l.append(2)
    k = 1
    while len(l) < x:
        l.append(1)
        l.append(2 * k)
        l.append(1)

        k += 1
    a = 1
    b = l[x - 1]
    for n in list(range(1, x)):
        a, b = b, b * l[x - n - 1] + a
#     b=b/gcd(a,b)
    print(b)
    sum = 0
    while b > 10:
        sum = sum + b % 10
        b = b // 10
    return(sum + b)
         
print(p65(100))        
        
